<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=8">
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
    <title></title>
    <script type="text/javascript" charset="utf-8"  src="../../editor_config.js"></script>
    <script type="text/javascript" charset="utf-8" >
    UEDITOR_CONFIG.UEDITOR_HOME_URL = "../../";
    UEDITOR_CONFIG.toolbars = [
        ['Source','Image']
    ];
    </script>
    <script type="text/javascript" charset="utf-8"  src="../../editor_ui_all.js"></script>
    <link rel="stylesheet" type="text/css" href="../../themes/default/ueditor.css"/>
    <style type="text/css">
        body{
            overflow:hidden;
        }
        #editor {
            border: 1px solid #CCC;
            width:300px;
            float:left;
            margin-left:20px;
            overflow:hidden;
        }
        #editor_toolbar_box {
            background: #F0F0EE;
            padding: 2px;

        }
        .edui-editor-toolbarboxinner{
            border-bottom:1px solid #ccc;
        }
        #editor_iframe_holder {
            border-top: 1px solid #CCC;
            border-bottom: 1px solid #CCC;
        }
        .left {
            float:left;
        }
    </style>
</head>
<body>
	<h3>自定义插件：点击图片后增加边框</h3>
    <div class="left">
        <input type="button" value="点击后给图片增加边框" onclick="useMyPlugin()"/>
    </div>
    <div id="editor">
        <div id="editor_iframe_holder"></div>
    </div>
    <script type="text/javascript" charset="utf-8">
        var editor = new baidu.editor.ui.Editor({
            initialContent: '给图片增加边框<br><img src="http://www.baidu.com/img/baidu_sylogo1.gif"/>',
            initialStyle :'.selectTdClass{background-color:#3399FF !important}',
            minFrameHeight: 200,
            autoClearinitialContent : false,                   //是否自动清除编辑器初始内容
            iframeCssUrl :'../../themes/default/iframe.css' ,
            elementPathEnabled:false
        });
        editor.render('editor_iframe_holder');
        var useMyPlugin = function(){
            baidu.editor.plugins["addborder"] = function(){
                editor.addListener( 'click', function( type, event ) {
                    var evt = event || window.event,
                    el = evt.target ? evt.target : evt.srcElement;
                    if(/img/ig.test(el.tagName)){
                        el.style.border = "1px solid red";
                    }
                } )
            }();
        };
    </script>
</body>
</html>